
$.notify = {};
$(function(o){
	o.updateData = function(showArea,mid){
		console.log(showArea)
		var reqUrl = "/meat/sec/merchant/get?mid="+mid;
		$.ajax({
			type : "GET",
			url  : reqUrl,
			dataType: 'json',
			success : function(obj){
				console.log(obj);
				if(obj.code==1){
					if(obj.data.state==1){
						$(showArea).html("You can now enter food manage").attr("href", "/meat/sec/menu/manager.jsp");
						$(showArea).parent().parent().show();
					}else if(obj.data.state==2){
						$(showArea).html("Check fail, you can upload again: "+obj.data.msg);
						$(showArea).parent().parent().show();
					}else{
						$(showArea).html("Info under review...");
						$(showArea).parent().parent().show();
					}
                }

			}
		});
	};
	
	o.work = function(showArea,mid,ms){
		window.setInterval( function(){ o.updateData(showArea,mid); } , ms );
	};
	
	o.getUrlParam = function(name){
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]); return null; //返回参数值
	};
	
}($.notify));
